package com.bigdata.booklibraryseatapi.controller;

import com.bigdata.booklibraryseatapi.common.pojo.PageResult;
import com.bigdata.booklibraryseatapi.common.pojo.SeatStatus;
import com.bigdata.booklibraryseatapi.service.IBookRecordService;
import com.bigdata.booklibraryseatapi.vo.req.*;
import com.bigdata.booklibraryseatapi.vo.resp.PageRecordRespVO;
import com.bigdata.booklibraryseatapi.vo.resp.UserBookStatusRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 预约记录 前端控制器
 * </p>
 *
 * @author book
 * @since 2023-12-13
 */
@RestController
@RequestMapping("/api")
@Api(value = "BookRecordController",tags = {"预约记录接口"})
@EnableTransactionManagement
public class BookRecordController {

    @Resource
    private IBookRecordService iBookRecordService;

    @PostMapping("/admin/record/create")
    @ApiOperation(value = "预约记录创建接口")
    public void createRecord(@RequestBody @Valid CreateRecordReqVO vo) {
        iBookRecordService.createRecord(vo);
    }
    @PostMapping("/admin/record/update")
    @ApiOperation(value = "预约记录更新接口")
    public void updateRecord(@RequestBody @Valid UpdateRecordReqVO vo) {
        iBookRecordService.updateRecord(vo);
    }
    @PostMapping("/admin/record")
    @ApiOperation(value = "预约记录分页接口")
    public PageResult<PageRecordRespVO> pageArea(@RequestBody @Valid PageRecordReqVO vo) {
        return iBookRecordService.pageRecord(vo);
    }

    @PostMapping("/admin/record/bookStatus")
    @ApiOperation(value = "用户预约情况接口")
    public List<UserBookStatusRespVO> pageArea(@RequestBody @Valid UserBookStatusReqVO vo) {
        return iBookRecordService.getUserBookStatus(vo);
    }

    @PostMapping("/admin/record/status")
    @ApiOperation(value = "座位预约接口")
    public List<String> getSeatStatus(@RequestBody @Valid GetSeatStatusReqVO vo) {
        return iBookRecordService.getSeatStatus(vo);
    }
}
